//
//  NetworkListener.h
//  EClub
//
//  Created by iBenz on 16/6/3.
//  Copyright © 2016年 EC. All rights reserved.
//

#import <Foundation/Foundation.h>

extern NSString *const kNetworkListenerChangedNotification;

typedef NS_ENUM(NSInteger, NetStatus) {
    NetStatusNone = 0,      // 无网络
    NetStatusWiFi = 2,      // wifi
    NetStatusCellular = 1   // 蜂窝网
};

@protocol NetworkListenerDelegate;
@interface NetworkListener : NSObject
@property(nonatomic, assign, readonly) NetStatus currentStatus;

+ (instancetype)shareListener;
- (void)addDelegate:(id<NetworkListenerDelegate>)aDelegate delegateQueue:(dispatch_queue_t)aQueue;
- (void)removeDelegate:(id<NetworkListenerDelegate>)aDelegate delegateQueue:(dispatch_queue_t)aQueue;
- (void)removeDelegate:(id<NetworkListenerDelegate>)delegate;
- (void)removeAllDelegates;
@end


@protocol NetworkListenerDelegate <NSObject>

@optional
- (void)networkListener:(NetworkListener *)listener didChangedToNetworkStatus:(NetStatus)status;
@end